#####################################
##       PEinjector/makelnk        ##
#####################################

import os
import log
import pylnk3

# Thank the project "pylnk3"

sysdrive = "X:"
if not os.path.exists(sysdrive+"\\"):
    sysdrive = "C:"
username = "Default"
for i in os.listdir(f"{sysdrive}\\Users"):
    if i not in ("Default", "Default User", "Public") and os.path.exists(f"{sysdrive}\\Users\\{i}\\Desktop"):
        username = i


def makelnk(name: str, exepath: str, iconpath: str) -> None:
    log.info(f"make shortcut \"{name}\"")
    pylnk3.for_file(exepath,
                    lnk_name=f"{sysdrive}\\Users\\{username}" +
                    f"\\Desktop\\{name}.lnk",
                    icon_file=iconpath
                    )
